#include <iostream>
using namespace std;

void func(int A[], int n) {
    for (int p = 1; p < n; p++) {
        int tmp = A[p];
        int i = p;
        while (i >= 1 && A[i - 1] > tmp) {
            A[i] = A[i - 1];
            i--;
        }
        A[i] = tmp;
    }
}

int main() {
    int A[] = { 28, 13, 45, 9, 36 };
    func(A, 5);
    for (int i = 0; i < 5; i++) cout << A[i] << " ";
    return 0;
}